<template>
      <view class="intro">
        <view class="intro-item">
          <view class="cell">
            <text class="intro-item-title">{{$t("orderId")}}</text>
            <text class="intro-item-value">{{data.id}}</text>
          </view>
          <view class="cell">
            <text class="intro-item-title status">{{$t("info.state")}}</text>
            <text class="intro-item-value success" v-if="data.status == 'Success'">{{$t("info.success")}}</text>
            <text class="intro-item-value failure" v-else-if="data.status == 'Failure'">{{$t("info.fail")}}</text>
            <text class="intro-item-value waiting" v-else>{{$t("info.wait")}}</text>
          </view>
        </view>
        <view class="intro-item">
          <view class="cell">
            <text class="intro-item-title">{{$t("coin")}}</text>
            <text class="intro-item-value">{{data.coin}}</text>
          </view>
        </view>
        <view class="intro-item">
          <view class="cell">
            <text class="intro-item-title">{{$t("info.number")}}</text>
            <text class="intro-item-value amount">{{data.amount}} {{data.coin}}</text>
          </view>
        </view>
        <view class="intro-item">
          <view class="cell">
            <text class="intro-item-title">{{$t("my.mention.service")}}</text>
            <text class="intro-item-value">{{data.fee}} {{data.coin}}</text>
          </view>
        </view>
        <view class="intro-item">
          <view class="cell">
            <text class="intro-item-title">{{$t("info.time")}}</text>
            <text class="intro-item-value">{{data.created_at}}</text>
          </view>
        </view>
        <view class="intro-item">
          <view class="cell" @click="addressCopy(data.address)">
            <text class="intro-item-title">{{$t("my.mention.address")}}</text>
            <text class="intro-item-value">{{data.address}}</text>
            <image src="@/static/my/copy.png" mode="" class="copy"></image>
          </view>
        </view>
        <view class="intro-item" v-if="data.status == 'Failure'">
          <view class="cell">
            <text class="intro-item-title">{{$t("info.reminder")}}</text>
            <text class="intro-item-value failure">{{data.reason}}</text>
          </view>
        </view>
      </view>
</template>

<script>
import HbNumberBox from "@/components/hb-number-box";
import HbCard from "../../../../components/hb-card";
export default {
  name: "record-item",
  components: {HbCard, HbNumberBox},
  props: {
    data: {
      default: {},
      type: Object
    }
  },
  methods: {
    addressCopy(text) {
      uni.setClipboardData({
        data: text,
        success: function () {
          uni.showToast({
            icon: 'success'
          })
        },
        fail: function () {
          uni.showToast({
            icon: 'fail'
          })
        }
      });
    }
  }
}
</script>

<style scoped lang="scss">
    .intro {
      background: #fff;
      padding: 32rpx;
      &-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-top: 24rpx;
        .cell {
          display: flex;
          align-items: center;
        }

        &-title {
          display: block;
          width: 120rpx;
          white-space: nowrap;
          font-size: 28rpx;
          color: $hb-text-color;
        }
        .status {
          width: auto;
        }
        &-value {
          font-weight: 700;
          font-size: 28rpx;
          color: $hb-title-color;
          margin-left: 12rpx;
          word-break:break-all;
        }
        .copy {
          color: $hb-primary-color;
          font-size: 24rpx;
          margin-left: 10rpx;
          width:25rpx;
          height:25rpx;
        }
        .coin {
            color: $hb-primary-color;
        }
       .amount {
         color: $hb-primary-color;
       }
       .success {
         color: $hb-success-color;
       }
       .failure {
        color: $hb-red;
       }
        // .waiting {
        //   color: $hb-info-color;
        // }
      }
    }
</style>
